<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vue入门指南——条件渲染</title>
    <link rel="stylesheet" href="common.css" />
    <script type="importmap">
      {
        "imports": {
          "vue": "https://lib.baomitu.com/vue/latest/vue.esm-browser.js"
        }
      }
    </script>
  </head>
  <body>
    <div id="app">
      <p v-if="isShow">{{message}}</p>
      <p v-else>条件渲染 另外一个分支</p>
      <!-- v-on:click === @click -->
      <p><button @click="isShow = !isShow">切换</button></p>
      <p>
        <template v-if="isShow">
          <div>一组标签</div>
          <div>内容</div>
        </template>
      </p>
      <p v-if="type === 'A'">A类型</p>
      <p v-else-if="type === 'B'">B类型</p>
      <p v-else-if="type === 'C'">C类型</p>
      <p v-else>非A/B/C类型</p>
    </div>
    <script type="module">
      import { createApp } from "vue";

      createApp({
        data() {
          return {
            message: "条件渲染",
            isShow: false,
            type: null,
            // type: "A"
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
